Context Sensitive HTML Help and Visual Basic Version 5

Visual Basic version 5 does not contain any native support for HTML Help.  What this means is that even if you compile your component with the 'Helpfile' property containing a valid .chm file, VB5 will assume the file is a Winhelp file and will display an error message if a user attempts to invoke context sensitive help for your component.

This is an issue with Visual Basic 5 that (with the release of Version 6) is unlikely to ever be resolved and the only current choice most Version 5 developers and users have is to continue to use the Winhelp standard to create and use Help files.

Document! VB offers a solution to this problem in the form of a 'Winhelp stub' file.  A Winhelp stub accepts and redirects Help requests from a development environment that only works with Winhelp files (i.e. Visual Basic 5) to your HTML Help file.  By doing so, it allows you to create HTML Help based context sensitive help that can be used by both VB5 and VB6 users.

Creating the WinHelp stub

Follow the steps below to make use of the 'Winhelp stub' feature :

  1. Make sure you have the Winhelp compiler installed on your machine (this comes pre-installed with Visual Studio 6, but you may have to locate it on the CD for previous versions and VB only installations - the filenames required are hcw.exe and hcrtf.exe);
  2. Check the 'Create context links', 'Create WinHelp stub' and 'Compile WinHelp stub' options in the Document! VB wizard (stage 5);
  3. Click on 'Finish'.  Document! VB will create both an HTML Help file and the required Winhelp stub files (the WinHelp stub files are created in a sub-directory of your chosen output directory named 'WinHelpStub').

Document! VB sets up all of the necessary registry settings such that after running the Document! VB wizard you can a) compile the version of your source generated by Document! VB (containing the Help Context IDs to support context sensistive help) and then b) test the help functionality in VB6 and / or VB5 on your development machine.

When shipping to VB5 users

  1. Ship the 2 .chm files created in the 'WinHelpStub' sub-directory of your chosen output directory (default file names will be <projectname>.chm and _<projectname>.chm;
  2. If you are creating a single setup package to support VB5 and VB6 users, also ship the normal .chm file created by Document! VB, copying each version to a seperate directory;
  3. Create as part of your setup process the registry entries described below to ensure the help files can be located by Windows;
  4. Make sure you ship the HTML Help viewer package with your application in case your target users do not have it installed.  The redistributable files are available from the microsoft HTML Help site
  5. Remember that Visual Basic 5 users need to have Internet Explorer version 4 or greater installed to be able to view your HTML Help files.

Registry Entries

Both WinHelp and HTML Help use the Windows registry to determine the location of a given help file.  The Document! VB WinHelp stub feature uses that fact to ensure that your HTML Help based documentation is available from within VB5 and 6.

The following registry entry should be created to support VB6 users for an imaginary project named SuperbComponent (NOTE that the registry entries described are automatically created by Document! VB on your development machine when your run the wizard) :

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\HTML Help\<filename.chm> = <Full path to normal help file>

The following 2 registry entries should be created to support VB5 users :

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Help\<filename.chm> = <Full path to help file created in WinHelpStub directory>
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\HTML Help\_<filename.chm> = <Full path to help file prefixed with underscore created in WinHelpStub directory>

When shipping to just VB6 users

  1. Forget the WinHelp stub file, simply ship the generated .chm file
  2. Set the following registry value :

    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\HTML Help\<filename.chm> = <Full path to normal help file>

Note You do not have to compile the source code generated by Document! VB containing the Help context IDs for users of different VB versions (unless you wish to), just follow the Help file naming method outlined above when shipping your software.

Quick Checklist